# -*- coding: utf-8 -*-
"""
 Created by wq.wang on 2017/12/21
"""
import logging

_logger = logging.getLogger(__name__)

SRVNOTEXIST = 1000, "服务不存在"
APINOTEXIST = 1001, "接口不存在"


class WError(Exception):
    """
    错误
    """


class WException(WError):
    """
    不能正常启动的异常
    """


class WWarniing(WError):
    """
    警告
    """

    def __init__(self, code, msg, data=None, env=None):
        self.code = code
        self.msg = msg
        self.data = data
        self.env = env


class SrvNotExist(WWarniing):
    def __init__(self, code=None, msg="", data=None, env=None):
        if not code:
            code, msg = SRVNOTEXIST
        super(SrvNotExist, self).__init__(code, msg, data, env)


class ApiNotExist(WWarniing):
    def __init__(self, code=None, msg="", data=None, env=None):
        if not code:
            code, msg = APINOTEXIST
        super(ApiNotExist, self).__init__(code, msg, data, env)
